package com.example.demo0331.controller;

import com.example.demo0331.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @RequestMapping
    public String hello(String name) {
        return "你好" + name;
    }

    @RequestMapping(value = "getUser", method = RequestMethod.GET)
    public User getUser() {
        User u = new User();
        u.setId(123);
        u.setName("wqewqew");
        return u;
    }

    @RequestMapping("/hello1")
    public String hello1(@RequestParam(name = "n", required = false) String name) {
        return name;
    }
}
